package handlers

import (
	"1-12zk/api/request"
	"1-12zk/api/response"
	"1-12zk/dao"
	"1-12zk/models"
	"github.com/gin-gonic/gin"
)

func AddFollOw(c *gin.Context) {
	UserId := c.GetUint("userId")
	var data request.AddFollow
	err := c.ShouldBind(&data)
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	follow := models.Follow{
		LikeId:    data.LikeId,
		ArticleId: data.ArticleId,
		UserId:    int(UserId),
	}
	err = dao.AddFollow(follow)
	if err != nil {
		response.ResponseError(c, "关注失败")
		return
	}
	response.ResponseSuccess(c, "关注成功")
}
